
import pytesseract
import requests
import cv2
import numpy as np

def recognize_number(url):
    rsp = requests.get(url)
    img = cv2.imdecode(np.fromstring(rsp.content, np.uint8), 1)
    result = pytesseract.image_to_string(img, lang="eng", config="--psm 7")
    #只保留数字
    result = ''.join([i for i in result if i.isdigit()])
    return result